|
|
Component
DDC1
DDC1 communication interface
Component Level: High
Category:
CPU Internal Peripherals-Communication
Typical Usage:
(Examples of a typical usage of the component in user code.
For more information please
see the page Component Code
Typical Usage.)
Assume the component name "DC1". Some examples of typical usage of this component follows:
(1)
MAIN.C
byte message[]={10,11,12};
byte snd;
void main(void)
{
:
snd = 0;
(void)DC1_SendChar(message[0]);
snd++;
:
}
EVENTS.C
extern byte snd;
extern byte message[];
void DC1_OnTxChar(void)
{
(void)DC1_SendChar(message[snd]);
snd++;
if(snd == 4) snd=0;
}
(2)
MAIN.C
byte message[]={10,11,12};
byte flag;
word snd;
void main(void)
{
:
flag = 0;
(void)DC1_SendBlock(message,3,&snd);
:
if (flag == 1) {
flag = 0;
/* message completed */
}
}
EVENTS.C
extern byte flag;
void DC1_OnFreeTxBuf(void)
{
flag = 1;
}
|